package com.starinside.wp.repository.cookbook;

import com.starinside.wp.domain.cookbook.Recipe;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Repository
public interface RecipeRepository extends JpaRepository<Recipe, Long>, JpaSpecificationExecutor<Recipe> {

    @Transactional
    void deleteByAreaIdAndRecipeTypeIdAndRecipeDateGreaterThan(String areaId, Long recipeTypeId, Date date);
    List<Recipe> findAllByAreaIdAndRecipeDateBetweenOrderByRecipeDateAsc(String areaId, Date startDate, Date endDate);

    Recipe findByAreaIdAndId(String areaId, Long id);
}